/////////////////////////////////////////////////////////////////////////////
// Name:        wininetinputstream.h
// Purpose:     MS-Windows native URL support based on WinINet
// Author:      Hajo Kirchhoff
// Modified by: yospaly
// Created:     06/11/2003
// Copyright:   (c) 2003 Hajo Kirchhoff
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef WININETSTREAM_H_
#define WININETSTREAM_H_

#include <wininet.h>

#include "wx/stream.h"


class WinINetInputStream : public wxInputStream
{
public:
    WinINetInputStream(const wxString& url);
    virtual ~WinINetInputStream();

    wxFileOffset SeekI( wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
        { return -1; }
    wxFileOffset TellI() const
        { return -1; }
    size_t GetSize();
    
    wxString CheckConnection();

protected:
    void SetError(wxStreamError err) { m_lasterror=err; }
    
    HINTERNET _connection;
    HINTERNET _internet;
    wxString _scheme;
    wxString _url;
    DWORD _size;
    
    size_t OnSysRead(void *buffer, size_t bufsize);

    DECLARE_NO_COPY_CLASS(WinINetInputStream)
};

#endif /* WININETSTREAM_H_ */
